﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
     protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
            HiddenField1.Value = "1";
        }

    }
    protected void btCheckElementIsAdded_Click(object sender, EventArgs e)
    {
        Response.Write(Request.Form["txtAddr"]);
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int nNum = Convert.ToInt16(HiddenField1.Value);

        for (int i = 0; i < nNum; i++)
        {
            TextBox t = new TextBox();
            t.ID = "txt" + i.ToString();
            nNum++;
            QuaDiv.Controls.Add(t);

        }


        //if (nNum == 1)
        //{
        //    TextBox t = new TextBox();
        //    t.ID = "txt" + nNum.ToString();
        //    nNum++;
        //    QuaDiv.Controls.Add(t);
        //}
        //else
    }
}
